#include <iostream>
using namespace std;

class Rec
{
	public :
		int m_x;
		int m_y;
		int m_length;
		int m_width;

	public :
		Rec(int x = 0, int y = 0, int length = 3, int width = 4) :
			m_x(x), m_y(y), m_length(length), m_width(width)
		{}

		friend void move(int newx, int newy, Rec &r);
		friend class Opt;

		friend istream& operator >>(istream& in, Rec& r);

		friend ostream& operator <<(ostream& out, Rec& r);
	protected :
};

void move(int newx, int newy, Rec &r)
{
	cout << "<Rec move()>" << endl;

	r.m_x = newx;
	r.m_y = newy;
}

class Opt
{
	private :
		int m_x1;
		int m_y1;

	public :
		void change(int x1, int y1, Rec &r);

	protected :
};

void Opt :: change(int x1, int y1, Rec &r)
{
	cout << "<Rec change()>" << endl;

	r.m_length += x1;
	r.m_width += y1;
}

istream& operator >>(istream& in, Rec& r)
{
	cout << "<My input()>" << endl;
	in >> r.m_x >> r.m_y >> r.m_length >> r.m_width;
	return in;
}

ostream& operator <<(ostream& out, Rec& r)
{
	out << "<My output()>" << endl <<"Point  : (" << r.m_x << " , " << r.m_y << ")" << endl << "Length : " << r.m_length << endl << "Width  : " << r.m_width;
	return out;
}

int main()
{
	Rec r1;
	Rec r2;
	Opt p1;

	cout << r1 << endl << endl;
	cin >> r1;
	cout << r1 << endl << endl;

	cout << "Please intput point and data :" << endl;
	cin >> r2.m_x >> r2.m_y >> r2.m_length >> r2.m_width;

	move(r2.m_x, r2.m_y, r1);
	p1.change(r2.m_length, r2.m_width, r1);

	cout << "After operator : " << endl << r1 << endl;

}
